const appData = require('./data.json');
const seller = appData.seller
const goods = appData.goods
const ratings = appData.ratings

module.exports = {
  devServer: {
    port: 8080,
    before(app) {
      app.get('/api/seller', (req, res, next) => {
        res.json({
          errno: 0,
          data: seller
        });
      })
      app.get('/api/goods', (req, res, next) => {
        res.json({
          errno: 0,
          data: goods
        });
      })
      app.get('/api/ratings', (req, res, next) => {
        res.json({
          errno: 0, //错误代码 0 表示正常请求
          data: ratings //将出去的数据给data 这个json里面就包含我们取出的数据和errno
        });
      })
    }
  }
}